Clover coverage report - Enterprise Web Services - 1.0
Coverage timestamp: Mon May 30 2005 17:10:32 CEST
file stats: LOC: 84   Methods: 3
NCLOC: 50   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
HandlerWriter.java 75% 93.1% 66.7% 88.9%
coverage coverage
 1   
 /*
 2   
  * Copyright 2001-2004 The Apache Software Foundation.
 3   
  * 
 4   
  * Licensed under the Apache License, Version 2.0 (the "License");
 5   
  * you may not use this file except in compliance with the License.
 6   
  * You may obtain a copy of the License at
 7   
  * 
 8   
  *      http://www.apache.org/licenses/LICENSE-2.0
 9   
  * 
 10   
  * Unless required by applicable law or agreed to in writing, software
 11   
  * distributed under the License is distributed on an "AS IS" BASIS,
 12   
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13   
  * See the License for the specific language governing permissions and
 14   
  * limitations under the License.
 15   
  */
 16   
 
 17   
 package org.apache.geronimo.ews.ws4j2ee.toWs.handlers;
 18   
 
 19   
 import org.apache.geronimo.ews.ws4j2ee.context.J2EEWebServiceContext;
 20   
 import org.apache.geronimo.ews.ws4j2ee.context.webservices.server.interfaces.WSCFHandler;
 21   
 import org.apache.geronimo.ews.ws4j2ee.context.webservices.server.interfaces.WSCFSOAPHeader;
 22   
 import org.apache.geronimo.ews.ws4j2ee.toWs.AbstractWriter;
 23   
 import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
 24   
 import org.apache.geronimo.ews.ws4j2ee.utils.Utils;
 25   
 
 26   
 /**
 27   
  * <p>Simpley print the Handler without much mess.</p>
 28   
  *
 29   
  * @author Srinath perera(hemapani@opensource.lk)
 30   
  */
 31   
 public class HandlerWriter extends AbstractWriter {
 32   
     private WSCFHandler handler;
 33   
     private String className = null;
 34   
     private String packageName = null;
 35   
 
 36   
     /**
 37   
      * @param j2eewscontext
 38   
      * @throws GenerationFault
 39   
      */
 40  2
     public HandlerWriter(J2EEWebServiceContext j2eewscontext, WSCFHandler handler)
 41   
             throws GenerationFault {
 42  2
         super(j2eewscontext, j2eewscontext.getMiscInfo().getOutPutPath()
 43   
                 + "/" + handler.getHandlerClass().replace('.', '/') + ".java");
 44  2
         this.handler = handler;
 45  2
         className = Utils.getClassNameFromQuallifiedName(handler.getHandlerClass());
 46  2
         packageName = Utils.getPackageNameFromQuallifiedName(handler.getHandlerClass());
 47   
     }
 48   
 
 49  0
     public String getFileName() {
 50  0
         throw new UnsupportedOperationException();
 51   
     }
 52   
 
 53   
     /**
 54   
      * just print it out
 55   
      */
 56  2
     public void writeCode() throws GenerationFault {
 57  2
         if (out == null)
 58  0
             return;
 59  2
         out.write("package " + packageName + ";\n");
 60  2
         out.write("import org.apache.axis.AxisFault;\n");
 61  2
         out.write("import org.apache.axis.MessageContext;\n");
 62  2
         out.write("public class " + className + " extends org.apache.axis.handlers.BasicHandler{\n");
 63  2
         out.write("\tpublic " + className + "(){\n");
 64  2
         out.write("\t\tsetName(\"" + handler.getHandlerName() + "\");\n");
 65  2
         out.write("\t}\n");
 66  2
         out.write("\tpublic void init(){}\n");
 67  2
         out.write("\tpublic void cleanup(){}\n");
 68  2
         out.write("\tpublic void onFault(MessageContext msgContext){}\n");
 69  2
         out.write("\tpublic void invoke(MessageContext msgContext) throws AxisFault{\n");
 70  2
         out.write("\t\t//write your implementation here\n");
 71  2
         out.write("\t}\n");
 72  2
         out.write("\tpublic java.util.List getUnderstoodHeaders() {\n");
 73  2
         out.write("\t\t    java.util.List list = new java.util.ArrayList();\n");
 74  2
         WSCFSOAPHeader[] headers = handler.getSoapHeader();
 75  2
         for (int i = 0; i < headers.length; i++) {
 76  1
             out.write("\t\tjavax.xml.namespace.QName name" + i + " = new javax.xml.namespace.QName(\"" + headers[i].getNamespaceURI() + "\",\"" + headers[i].getNamespaceURI() + "\");\n");
 77  1
             out.write("\t\tlist.add(name" + i + ");\n");
 78   
         }
 79  2
         out.write("\t\treturn list;\n");
 80  2
         out.write("\t}\n");
 81  2
         out.write("}");
 82   
     }
 83   
 }
 84